package pub.tbc.hh.mall.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pub.tbc.hh.mall.service.ShoppingCartService;

import java.util.List;
import java.util.Map;

/**
 * @author tbc  by 2018/5/26
 */
@RestController
public class ShoppingCartController {

    @Autowired
    private ShoppingCartService shoppingCartService;


//    4. 向购物车添加商品；{用户ID:[{商品ID:商品数量}]}
//    * 返回：添加状态
    @PostMapping("/cart")
    public Object addWares(@RequestBody Map<Long, List<Map<Long, Integer>>> param){


        return shoppingCartService.addWares(param);
    }




//5. 从购物车删除商品；参数：json-{用户ID:[{商品ID:商品数量}]}
    @PutMapping("/cart")
    public Object updateWares(@RequestBody Map<String, Object> param){

        return null;
    }



//6. 按用户ID查询购物车内商品列表； 参数：用户ID
//    * 返回：商品明细：[商品ID，商品名称，商品属性，商品图片，商品价格，添加数量，商品状态(是否下架)]



}
